<template>
	<div class="card-box" @click.stop='goDetail($event,data.id,data.qi)'>
		<div class="card-linetime">
			<p class="card-name">
				{{data.name}}
				<span>{{data.qi}}期</span>
			</p> 
			<p class="card-week" v-if='data.time'>{{data.time}} [{{DegetDate(data.time?data.time.substring(0,10):'')}}]</p>
		</div> 
		<div class="card-list" v-if='data.code'>
			<!--竞彩足球或竞彩篮球-->
			<template v-if='data.id=="jclq"||data.id=="jczq"||data.id=="85"'>
				<div class="card-match">
		            比赛共 <span class="match-all">{{data.total}}</span> 场，已开奖 <span class="match-nums">{{data.yjNum}}</span> 场
		        </div>
			</template>
			<!--胜负彩/任选九 6场半全场 4场进球彩-->
			<template v-else-if='data.id=="80"||data.id=="81"||data.id=="82"||data.id=="83"'>
				<div class="card-vic">
					<em v-for='item in data.code.split(",")'>{{item}}</em>
				</div> 
			</template>
			<template v-else>
				<div class="card-ball ball-small">
					<template v-if='data.code&&data.code.indexOf("|")>-1'>
						<em v-for='num1 in data.code.split("|")[0].split(",")'>{{num1}}</em>
						<em class="blue-ball" v-for='num2 in data.code.split("|")[1].split(",")'>{{num2}}</em>
					</template>
					<template v-else >
						<em v-for='num3 in data.code.split(",")'>{{num3}}</em>
					</template>
				</div> 
			</template>
			
			<div class="card-mricon"></div>
		</div> 
		<div class="card-listbtn">
			<div class="card-btnbox" v-if='!("80,81,82,83,jczq,jclq,85".indexOf(data.id)>-1)' @click.stop="goUrl('走势图',data.id)">
				<div class="card-btn">走势图</div>
			</div>
			<div class="card-btnbox" v-if='zxList.indexOf(data.id)>-1' @click.stop="goUrl('资讯',data.id)">
				<div class="card-btn">资讯</div>
			</div>
			<div class="card-btnbox" v-if='!("jczq,jclq,85".indexOf(data.id)>-1)'  @click.stop="goUrl('玩法',data.id)">
				<div class="card-btn">玩法</div>
			</div>
		</div>
	</div>
</template>
<script>
import {getDate} from '@/assets/js/layout'
	export default{
		props:{
			data: {
		      type: Object,
		      default: function () {
		        return {}
		      }
		    },
		},
		data(){
			return{
				zxList:'50,51,52,53,01,03,07',//有资讯内容的彩种
				qgZstList:'50,51,52,53,55,01,03,07', //全国下面这些彩种走势图不一样
			}
		},
		methods:{
		    DegetDate(date){
		        let week = getDate(date);
		        return week
		    },
		    goDetail(event,id,pid){
		     	if (event.target.className != 'card-btn') {
		     		if (id=='jczq') {
		     			this.$router.push('/detail/jczq/'+pid);
			     	}else if (id=='jclq') {
			     		this.$router.push('/detail/jclq/'+pid)
			     	}else if (id=='85') {
			     		this.$router.push('/detail/zd/'+pid)
			     	}else{
			     		this.$router.push('/detail/index/'+id+'/'+pid)
			     	}
		     	}
		    },
		    goUrl(name,id){
		    	if (name == '走势图') {
		    		if (this.qgZstList.indexOf(id)>-1) {
		    			let name = this.lotteryId[id][3];
		    			console.log(name)
		    			window.location.href ='https://m.178ty.com/zst/'+name+'.html'
		    		}else{
		    			window.location.href ='https://m.178ty.com/zst/'+id+'/01.html'
		    		}
		    	}
		    	if (name == '资讯') {
		    		this.$router.push('/information/'+id)
		    	}
		    	if (name == '玩法') {
		    		let val = this.lotteryId[id][0]
		    		this.$router.push('/explain/'+id+'&'+val)
		    	}
		    }
		},
	};
</script>
<style lang="less" scoped>
	@import './list.less';
</style>